<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Controller\agent;

use App\Kernel\Util\AgentJwtInstance;
use App\Service\Agent\StoreService;
use App\Request\Agent\Auth\registerRequest;
use Hyperf\Guzzle\ClientFactory;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\Snowflake\IdGeneratorInterface;

/**
 * 代理商用户鉴权控制器
 *
 * @AutoController()
 * @author 张昊(2396675557@qq.com)
 * @package App\Controller\admin
 */
class AuthController extends Controller
{

    /**
     * 后台用户服务
     * @Inject
     * @var StoreService
     */
    private $store_service;

    /**
     * 登录接口
     *
     * @param registerRequest $request
     */
    public function login(registerRequest $request)
    {
        $params = $request->all();

        isset($params['phone']) && $params['phone'] = trim($params['phone']);
        isset($params['login_pwd']) && $params['login_pwd'] = trim($params['login_pwd']);

        $result = $this->store_service->login($params['phone'], $params['login_pwd']);

        $this->success($result);
    }

}